package com.tgy.framework.config;

import org.apache.ibatis.type.LocalDateTimeTypeHandler;
import org.springframework.context.annotation.Configuration;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;

/**
 * @author tianguiyin
 * @version 1.0
 * @date 2022/7/6 20:15
 */
@Configuration
public class LocalDateTimeConfig extends LocalDateTimeTypeHandler {

    @Override
    public LocalDateTime getResult(ResultSet rs, int columnIndex) throws SQLException {
        Object object = rs.getObject(columnIndex);
        if (object == null){
            return null;
        }
        return super.getResult(rs, columnIndex);
    }
}
